-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(path): add convert_file_src to PathResolver #14786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
|
This adds the Rust equivalent of the JavaScript
Platform-specific URL schemes:
Socket Security checks passed. |
|
All checks passed. What this adds The Rust equivalent of the JavaScript Implementation details
Why this matters Previously you had to use the JS bridge to call Testing
|
This comment was marked as spam.
This comment was marked as spam.
FabianLars
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! On top of the https comments, i need you to sign your commits to be able to merge the PR. Lastly, a small changefile will be needed (check .changes dir).
Thanks again :)
Adds a Rust equivalent of the JavaScript `convertFileSrc` function to the PathResolver API, enabling file-to-URL conversion from Rust code. This is useful when processing file paths in Rust (e.g., parsing markdown with image references) and needing to convert them to URLs that the webview can load. The implementation: - Uses percent-encoding for URL-safe path encoding - Uses dunce::simplified to normalize Windows paths - Returns HTTP URLs on Windows/Android and custom protocol URLs elsewhere - Adds `use_https` parameter to support webviews with `use_https_scheme` enabled Closes tauri-apps#12022
70b74d0 to
52154ed
Compare
|
Added the |
Summary
Adds a Rust equivalent of the JavaScript
convertFileSrcfunction to thePathResolverAPI. This enables file-to-URL conversion from Rust code, which is useful when processing file paths in Rust (e.g., parsing markdown with image references) and needing to convert them to URLs that the webview can load.The implementation:
percent-encodingfor URL-safe path encoding (already a dependency)dunce::simplifiedto normalize Windows paths (already a dependency)Usage
Test plan
PathResolverin desktop.rsPathResolverin android.rsCloses #12022